const _ = require("lodash");

const reverse = (array) => array.reverse();
const first = (array) => array[0];
const toUpper = (s) => s.toUpperCase();

const getLastElementToUpperFn = _.flowRight(toUpper, first, reverse);
console.log(getLastElementToUpperFn(["one", "two", "three"]));
